export default ({ $axios, store }) => {
  // 设置请求地址 .env
  $axios.setBaseURL(process.env.BASE_URL);

  // 设置全局请求拦截器: 处理请求参数携带上 token
  $axios.interceptors.request.use(request => {
    request.data = request.data || {};
    const authToken = store.state.token;
    if (authToken) {
      request.data.token = authToken.token;
    }
    return request;
  });
};
